package com.zl.web;/**
 * @author suke
 * @create 2021-08-03 16:37
 */

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 处理器
 * @ClassName: HelloHandler
 * @author: suke
 * @since: 2021/8/3 16:37
 */
public class HelloHandler implements Controller{

    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        //ModelAndView 存放数据(默认存在request域) 和设置逻辑视图名
        ModelAndView modelAndView = new ModelAndView();
        //添加数据 默认存在request域
        modelAndView.addObject("msg","helloworld");
        //设置逻辑视图名
        modelAndView.setViewName("hello");
        return modelAndView;
    }
}
